GXIntersectRectangle
You can use theGXIntersectRectangle
function to find the intersection of two rectangles.
gxBoolean GXIntersectRectangle(gxRectangle *target, const gxRectangle *source, const gxRectangle *operand);
target
- A pointer to a
gxRectangle
structure. On return, the intersection of the source and operand rectangles. You may specify the valuenil
for this parameter if you do not want the intersection to be calculated. Depending on the result of the intersection operation, this pointer may point to the source or operand rectangle.source
- A pointer to one of the rectangles to intersect.
operand
- A pointer to the other rectangle to intersect.
- function result
- A Boolean value indicating whether the rectangles intersect.
DESCRIPTION
TheGXIntersectRectangle
function returnstrue
as its function result if the source rectangle and the operand rectangle intersect, and returnsfalse
otherwise.If you provide a pointer for the
target
parameter that is notnil
, this function returns the intersection of the source and operand rectangles in thegxRectangle
structure pointed to by thetarget
parameter.If the source rectangle and the operand rectangle do not intersect or share only one edge, this function returns
false
and does not affect the target rectangle.You may specify the source rectangle or the operand rectangle as the target rectangle. In this case, the function calculates the intersection of the original rectangles and then places the calculated intersection into the source or operand rectangle, as specified.
Notice that the parameters to this function are not shapes; they are pointers to
gxRectangle
data structures.ERRORS, WARNINGS, AND NOTICES
Errors parameter_is_nil SEE ALSO
For a discussion of thegxRectangle
data structure, see Chapter 2, "Geometric Shapes."For a discussion of geometric arithmetic, see "Geometric Arithmetic" beginning on page 4-21.
To find the intersection of two shapes, use the
GXIntersectShape
function, described on page 4-107.To find the union of two rectangles, use the
GXUnionRectangle
function, described in the next section.
Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help